/*
 * RSInstance.h
 *
 *  Created on: 2010/03/13
 *      Author: alexandre
 */

#ifndef RSINSTANCE_H_
#define RSINSTANCE_H_

#include "RSElement.h"

namespace Realsphere {

    class RSInstance : public Realsphere::RSElement {
        Q_OBJECT
        Q_PROPERTY ( QString _attr_name READ Name WRITE SetName )
        Q_PROPERTY ( QString _attr_sid READ ScopeId WRITE SetScopeId )
        Q_PROPERTY ( QString _attr_url READ Url WRITE SetUrl )
        public:
            RSInstance ( RSInstanceType rInstanceType,
                         const QString& rUrl,
                         const QString& rName = QString::null,
                         const QString& rScopeId = QString::null );
            virtual ~RSInstance ();

        public:
            QString                 ScopeId () const;
            QString                 Url () const;
            RSInstanceType          InstanceType () const;

        public slots:
            void                    SetScopeId ( const QString& rScopeId, bool rEmit = true );
            void                    SetUrl ( const QString& rUrl, bool rEmit = true );

        signals:
            void                    ScopeIdChanged ( const QString& rScopeId );
            void                    UrlChanged ( const QString& rUrl );

        public:
            static QString          InstanceTypeToTag ( RSInstanceType rInstanceType );
            static RSInstanceType   InstanceTagToType ( const QString& rTag );

        private:
            QString                 mScopeId;
            QString                 mUrl;
            RSInstanceType          mInstanceType;
    };

}

#endif /* RSINSTANCE_H_ */
